<?php

;//require_once 'Base/NewsRow.php';

/**
 * Generated Model class.
 */
class NewsRow extends Base_NewsRow implements IContentListElementProvider 
{
	public function getContentListElement($type = null)
	{
		$element = new List_News();
		$element->setName($this->getName());
		$element->setText($this->getText());
		$url = u(array('module' => 'default', 'controller' => 'news', 'id' => $this->getId()), null, true);
		$element->setUrl($url);
		
		$element->setComments($this->getCommentCount());
		$profileRow = $this->getProfileRowByProfileId();
		if ($profileRow) {
			$element->setProfileName($profileRow->getFirstName());
		}
		try {
			$photoRow = $this->getPhotoRowByPhotoId();
		} catch (Exception $e) {}
		
		if ($photoRow) {
			$element->setPhoto($photoRow->getUrl());
		}
		$element->setDate($this->getDate());
		return $element; 
	}

}

